package top.lixunda.demo.seata.common.config;

import com.alibaba.cloud.seata.web.SeataHandlerInterceptor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author LiXunda
 * @version time:2019/11/12 9:20
 */
@Configuration
@Slf4j
public class InterceptorConfig extends WebMvcConfigurationSupport {

    public InterceptorConfig() {
        super();
        log.debug("WebMvcConfigurationSupport");
    }

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new SeataHandlerInterceptor()).addPathPatterns("/**");
        log.debug("添加 SeataHandlerInterceptor");
        super.addInterceptors(registry);
    }
}
